package b.m;

import android.animation.TimeInterpolator;
import android.util.AndroidRuntimeException;
import android.view.View;
import android.view.ViewGroup;
import b.m.m;
import java.util.ArrayList;
import java.util.Iterator;

public class q extends m {
    private ArrayList<m> K = new ArrayList<>();
    private boolean L = true;
    int M;
    boolean N = false;
    private int O = 0;

    class a extends n {

        /* renamed from: a  reason: collision with root package name */
        final /* synthetic */ m f1461a;

        a(q qVar, m mVar) {
            this.f1461a = mVar;
        }

        public void e(m mVar) {
            this.f1461a.T();
            mVar.P(this);
        }
    }

    static class b extends n {

        /* renamed from: a  reason: collision with root package name */
        q f1462a;

        b(q qVar) {
            this.f1462a = qVar;
        }

        public void c(m mVar) {
            q qVar = this.f1462a;
            if (!qVar.N) {
                qVar.a0();
                this.f1462a.N = true;
            }
        }

        public void e(m mVar) {
            q qVar = this.f1462a;
            int i = qVar.M - 1;
            qVar.M = i;
            if (i == 0) {
                qVar.N = false;
                qVar.p();
            }
            mVar.P(this);
        }
    }

    private void f0(m mVar) {
        this.K.add(mVar);
        mVar.s = this;
    }

    private void o0() {
        b bVar = new b(this);
        Iterator<m> it = this.K.iterator();
        while (it.hasNext()) {
            it.next().a(bVar);
        }
        this.M = this.K.size();
    }

    public void N(View view) {
        super.N(view);
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            this.K.get(i).N(view);
        }
    }

    public void R(View view) {
        super.R(view);
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            this.K.get(i).R(view);
        }
    }

    /* access modifiers changed from: protected */
    public void T() {
        if (this.K.isEmpty()) {
            a0();
            p();
            return;
        }
        o0();
        if (!this.L) {
            for (int i = 1; i < this.K.size(); i++) {
                this.K.get(i - 1).a(new a(this, this.K.get(i)));
            }
            m mVar = this.K.get(0);
            if (mVar != null) {
                mVar.T();
                return;
            }
            return;
        }
        Iterator<m> it = this.K.iterator();
        while (it.hasNext()) {
            it.next().T();
        }
    }

    public /* bridge */ /* synthetic */ m U(long j) {
        k0(j);
        return this;
    }

    public void V(m.e eVar) {
        super.V(eVar);
        this.O |= 8;
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            this.K.get(i).V(eVar);
        }
    }

    public void X(g gVar) {
        super.X(gVar);
        this.O |= 4;
        if (this.K != null) {
            for (int i = 0; i < this.K.size(); i++) {
                this.K.get(i).X(gVar);
            }
        }
    }

    public void Y(p pVar) {
        super.Y(pVar);
        this.O |= 2;
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            this.K.get(i).Y(pVar);
        }
    }

    /* access modifiers changed from: package-private */
    public String b0(String str) {
        String b0 = super.b0(str);
        for (int i = 0; i < this.K.size(); i++) {
            StringBuilder sb = new StringBuilder();
            sb.append(b0);
            sb.append("\n");
            sb.append(this.K.get(i).b0(str + "  "));
            b0 = sb.toString();
        }
        return b0;
    }

    /* renamed from: c0 */
    public q a(m.f fVar) {
        super.a(fVar);
        return this;
    }

    /* renamed from: d0 */
    public q b(View view) {
        for (int i = 0; i < this.K.size(); i++) {
            this.K.get(i).b(view);
        }
        super.b(view);
        return this;
    }

    public q e0(m mVar) {
        f0(mVar);
        long j = this.f1446d;
        if (j >= 0) {
            mVar.U(j);
        }
        if ((this.O & 1) != 0) {
            mVar.W(s());
        }
        if ((this.O & 2) != 0) {
            mVar.Y(w());
        }
        if ((this.O & 4) != 0) {
            mVar.X(v());
        }
        if ((this.O & 8) != 0) {
            mVar.V(r());
        }
        return this;
    }

    /* access modifiers changed from: protected */
    public void f() {
        super.f();
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            this.K.get(i).f();
        }
    }

    public void g(s sVar) {
        if (G(sVar.f1467b)) {
            Iterator<m> it = this.K.iterator();
            while (it.hasNext()) {
                m next = it.next();
                if (next.G(sVar.f1467b)) {
                    next.g(sVar);
                    sVar.f1468c.add(next);
                }
            }
        }
    }

    public m g0(int i) {
        if (i < 0 || i >= this.K.size()) {
            return null;
        }
        return this.K.get(i);
    }

    public int h0() {
        return this.K.size();
    }

    /* access modifiers changed from: package-private */
    public void i(s sVar) {
        super.i(sVar);
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            this.K.get(i).i(sVar);
        }
    }

    /* renamed from: i0 */
    public q P(m.f fVar) {
        super.P(fVar);
        return this;
    }

    public void j(s sVar) {
        if (G(sVar.f1467b)) {
            Iterator<m> it = this.K.iterator();
            while (it.hasNext()) {
                m next = it.next();
                if (next.G(sVar.f1467b)) {
                    next.j(sVar);
                    sVar.f1468c.add(next);
                }
            }
        }
    }

    /* renamed from: j0 */
    public q Q(View view) {
        for (int i = 0; i < this.K.size(); i++) {
            this.K.get(i).Q(view);
        }
        super.Q(view);
        return this;
    }

    public q k0(long j) {
        ArrayList<m> arrayList;
        super.U(j);
        if (this.f1446d >= 0 && (arrayList = this.K) != null) {
            int size = arrayList.size();
            for (int i = 0; i < size; i++) {
                this.K.get(i).U(j);
            }
        }
        return this;
    }

    /* renamed from: l0 */
    public q W(TimeInterpolator timeInterpolator) {
        this.O |= 1;
        ArrayList<m> arrayList = this.K;
        if (arrayList != null) {
            int size = arrayList.size();
            for (int i = 0; i < size; i++) {
                this.K.get(i).W(timeInterpolator);
            }
        }
        super.W(timeInterpolator);
        return this;
    }

    /* renamed from: m */
    public m clone() {
        q qVar = (q) super.clone();
        qVar.K = new ArrayList<>();
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            qVar.f0(this.K.get(i).clone());
        }
        return qVar;
    }

    public q m0(int i) {
        if (i == 0) {
            this.L = true;
        } else if (i == 1) {
            this.L = false;
        } else {
            throw new AndroidRuntimeException("Invalid parameter for TransitionSet ordering: " + i);
        }
        return this;
    }

    /* renamed from: n0 */
    public q Z(long j) {
        super.Z(j);
        return this;
    }

    /* access modifiers changed from: protected */
    public void o(ViewGroup viewGroup, t tVar, t tVar2, ArrayList<s> arrayList, ArrayList<s> arrayList2) {
        long y = y();
        int size = this.K.size();
        for (int i = 0; i < size; i++) {
            m mVar = this.K.get(i);
            if (y > 0 && (this.L || i == 0)) {
                long y2 = mVar.y();
                if (y2 > 0) {
                    mVar.Z(y2 + y);
                } else {
                    mVar.Z(y);
                }
            }
            mVar.o(viewGroup, tVar, tVar2, arrayList, arrayList2);
        }
    }
}
